package com.horizon.service.impl;

import com.horizon.mybatis.entity.UserPO;
import com.horizon.service.UserService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import javax.annotation.Resource;

public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public UserPO login(UserPO user)
    {
 /*       User sample = new User();
        sample.setUserName(user.getUserName());
        User u = userMapper.selectOne(sample);
        if (null == u) {
            log.info("找不到用户信息 username={}", user.getUserName());

            return null;

        }
*/
        //为了简化演示，去掉数据库的部分

        return user;
    }

    @Cacheable(value = "HorizonIMKEY:User", key = "#userId")
    public UserPO getById(String userid) {
        return null;
    }
//指定了allEnties时，key属性没有意义
    @CacheEvict(value = "CrazyIMKey:User", key = "#userid", beforeInvocation = true,allEntries = true,condition = "")
    public int deleteById(String userid) {
        return 0;
    }
}
